//
//  AccountTicketCell.m
//  ImGuider
//
//  Created by llt on 2017/6/21.
//  Copyright © 2017年 imguider. All rights reserved.
//

#import "AccountTicketCell.h"

@interface AccountTicketCell()
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *descripeLabel;
@property (weak, nonatomic) IBOutlet UIButton *useBtn;

@end

@implementation AccountTicketCell


- (void)awakeFromNib {
    
    [super awakeFromNib];
    
    self.useBtn.layer.borderWidth = 1.0f;
    self.useBtn.layer.borderColor = kThemeColor.CGColor;
    self.useBtn.titleLabel.text = MYLocalizedString(@"VOUCHER_USE_NOW", nil);
}


- (void)setCoupon:(Coupon *)coupon {
    
    _coupon = coupon;
    self.nameLabel.text = coupon.infos[@"title"];
    self.typeLabel.text = coupon.infos[@"middle"];
    self.priceLabel.text = coupon.infos[@"big"];
    self.descripeLabel.text = coupon.infos[@"desc"];
    
    if (self.pageType == 1) {
        self.useBtn.hidden = YES;
        return;
    }
    
    self.useBtn.hidden = ![coupon.infos[@"canquickuse"] boolValue];
    
////    优惠券类型（1一元购，2免费听，3定向城市，4定向景点，5定向线路，9 携程优惠券）
//    switch ([ integerValue]) {
//        case 1:
//        case 2:
//        case 3: {
//            
//            self.useBtn.hidden = YES;
//        }
//            break;
//        default:
//            self.useBtn.hidden = NO;
//            break;
//    }
}
- (IBAction)useCouponAction:(id)sender {
    
    if ([_delegate respondsToSelector:@selector(useCouponCell:coupon:)]) {
        [_delegate useCouponCell:self coupon:self.coupon];
    }
}

@end
